﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SDT.DataService.Repositories;
using SDT.Libraries.Utilities;
using SDT.DataService.Contexts;

namespace SDT.DataService.Services
{
  public  class News_SiteService : IService< Spider_Site_News>
    {

        
        private IRepository<Spider_Site_News> repository;
        



        public News_SiteService()
            : this(new Repository<Spider_Site_News>())
        {
        }

        public News_SiteService(IRepository<Spider_Site_News> repository)
        {
            this.repository = repository;
          
        }
        public int InsertChannel(int siteId,string name)
        {
            News_SiteContext contextObj = new News_SiteContext();
            try
            {
                return contextObj.InsertChannel(siteId,name);
            }
            catch (Exception ex)
            {
                new LogException().Write(string.Format("  Module {0} --Msg {1} ", "Spider_StieService.InsertChannel", ex.Message));

            }
            finally { contextObj.Dispose(); }
            return 0;

        }
        public int UpdateChannel(int cid, string name)
        {
            News_SiteContext contextObj = new News_SiteContext();
            try
            {
                return contextObj.UpdateChannel(cid, name);
            }
            catch (Exception ex)
            {
                new LogException().Write(string.Format("  Module {0} --Msg {1} ", "Spider_StieService.UpdateChannel", ex.Message));

            }
            finally { contextObj.Dispose(); }
            return 0;
        }

        public IQueryable<Spider_Site_News> GetAll()
        {
            return repository.GetAll();
        }

        public bool Update(Spider_Site_News entity)
        {
            throw new NotImplementedException();
        }

        public bool Create(Spider_Site_News entity)
        {
            throw new NotImplementedException();
        }

        public bool Delete(Spider_Site_News entity)
        {
            throw new NotImplementedException();
        }
    }
}
